package com.gopay.common.riskcontrol.service.impl;

import com.gopay.common.domain.riskcontrol.RcDicKvpConf;
import com.gopay.common.riskcontrol.dao.RcDicKvpConfQueryDAO;
import com.gopay.common.riskcontrol.service.RcDicKvpConfQueryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Created by liuyong on 2017/9/4.
 */
@Service("rcDicKvpConfQueryService")
public class RcDicKvpConfQueryServiceImpl implements RcDicKvpConfQueryService {


    @Resource(name = "rcDicKvpConfQueryDAO")
    private RcDicKvpConfQueryDAO rcDicKvpConfQueryDAO;

    @Override
    public String getCustKvpValue(String custId,String kvpType) {

        RcDicKvpConf rcDicKvpConf = rcDicKvpConfQueryDAO.findRcDicKvpConf(custId,kvpType);
        if(rcDicKvpConf==null){
            rcDicKvpConf = rcDicKvpConfQueryDAO.findDefaultDicKvpConf(kvpType);
        }

        return rcDicKvpConf.getValue();
    }
}
